// Copyright (c) 2009 Hypirinha contributers
// This program is made available under the terms of the MIT License.
package org.hypirinha.html.codegen;

import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class AttributeTest {

    @Test
    public void shouldGenerateMethodBodiesThatInstantiateChildElements() {
        Attribute attribute = new Attribute("physical");
        attribute.addApplicableElement("air");
        attribute.addApplicableElement("earth");
        attribute.addApplicableElement("water");
        GeneratedClass generatedClass = attribute.createAttributeImplementation();

        assertTrue(generatedClass.getImplementedInterfaces().contains("Air.Attribute"));
        assertTrue(generatedClass.getImplementedInterfaces().contains("Earth.Attribute"));
        assertTrue(generatedClass.getImplementedInterfaces().contains("Water.Attribute"));
    }

    @Test
    public void shouldRemoveSpecialCharacters() {
        assertEquals("xmllang", CodegenUtil.removeSpecialCharacters("xml:lang"));
    }
}